/////////////////////////////////////////////////////////////////////////////
// Name:        imagevalidator.h
// Purpose:     wxImageValidator class
// Author:      Julian Smart
// Modified by:
// Created:     July 27th 2007
// RCS-ID:      $Id: imagevalidator.h,v 1.1 2007/07/31 21:24:53 anthemion Exp $
// Copyright:   (c) Julian Smart
// Licence:     wxWindows licence
/////////////////////////////////////////////////////////////////////////////

#ifndef _WX_IMAGEVALIDATORH__
#define _WX_IMAGEVALIDATORH__

#include "wx/valgen.h"
#include "wx/image.h"
#include "imageblock.h"

#if wxUSE_VALIDATORS

class WXDLLEXPORT wxImageValidator: public wxValidator
{
    DECLARE_CLASS(wxImageValidator)
    DECLARE_EVENT_TABLE()
public:
    wxImageValidator(wxImageBlock* imageBlock = NULL);
    wxImageValidator(const wxImageValidator& copyFrom);
    
    virtual ~wxImageValidator(){}
    
    // Make a clone of this validator (or return NULL) - currently necessary
    // if you're passing a reference to a validator.
    // Another possibility is to always pass a pointer to a new validator
    // (so the calling code can use a copy constructor of the relevant class).
    virtual wxObject *Clone() const { return new wxImageValidator(*this); }
    bool Copy(const wxImageValidator& val);
    
    // Called when the value in the window must be validated.
    // This function can pop up an error message.
    virtual bool Validate(wxWindow * WXUNUSED(parent)) { return true; }
    
    // Called to transfer data to the window
    virtual bool TransferToWindow();
    
    // Called to transfer data to the window
    virtual bool TransferFromWindow();

    // Respond to left click
    void OnLeftClick(wxMouseEvent& event);
    
protected:
    
    // Initialize
    void Init();
    
    wxImageBlock*   m_imageBlock;

private:
    // Cannot use
    //  DECLARE_NO_COPY_CLASS(wxImageValidator)
    // because copy constructor is explicitly declared above;
    // but no copy assignment operator is defined, so declare
    // it private to prevent the compiler from defining it:
    wxImageValidator& operator=(const wxImageValidator&);
};

#endif
  // wxUSE_VALIDATORS

#endif
  // _WX_IMAGEVALIDATORH__
